﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Settings = OMC.Properties.Settings;
using Manager = OMC.DataManagement.Manager;
using MailContent = OMC.DataManagement.MailContent;

namespace OMC.UserInterface
{
    /// <summary>
    /// MyForm is a form to display options. the options form could be use to
    /// customize Outlook Mail Classifier
    /// </summary>
    partial class MyForm : Form
    {
        Manager TheManager;
        /// <summary>
        /// constructor to create a new object of MyForm
        /// </summary>
        public MyForm(Manager inManager)
        {
            TheManager = inManager;
            InitializeComponent();
            groupBox1.Text = "Text Vorbearbeitung";
            groupBox2.Text = "Text Analyse";
            label1.Text = "Klassifizierer wählen:";
            TheCheckBoxLuceneAnalyzer.Text = "Deutsche Stopwörter verwenden";
            TheComboBoxClassifier.Text = "Classifier wählen";
            TheComboBoxClassifier.DropDownStyle = ComboBoxStyle.DropDownList;
            TheComboBoxClassifier.Items.Add("NaiveBayesMultinomialUpdateable");
            TheOkButton.Text = "OK";
            this.Text = "Optionen";
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
            this.StartPosition = FormStartPosition.CenterScreen;
            
        }

        private void checkBoxLuceneAnalyzer_CheckedChanged(object sender, EventArgs e)
        {
            Settings.Default.luceneAnalyzer = TheCheckBoxLuceneAnalyzer.Checked;
        }

        private void comboBoxClassifier_SelectedIndexChanged(object sender, EventArgs e)
        {
            Settings.Default.classifierIndex = TheComboBoxClassifier.SelectedIndex;           
        }

        private void buttonOk_Click(object sender, EventArgs e)
        {
            //save the settings 
            Settings.Default.Save();
            TheManager.loadCustomProperties();
            this.Close();
        }

        private void MyForm_Load(object sender, EventArgs e)
        {
            TheCheckBoxLuceneAnalyzer.Checked = Settings.Default.luceneAnalyzer;
            TheComboBoxClassifier.SelectedIndex = Settings.Default.classifierIndex;
        }
    }
}
